const router = require('koa-router')()
const userController = require('../controller/userController')

router.prefix('/users')

router.get('/findAll',userController.findAll)
//模糊查询
router.post('/findByName',userController.findByName)
//模糊查询 + 分页查询
router.post('/findByPage',userController.findByPage)
/**
 * @swagger
 * /users/add:
 *    post:
 *      tags:
 *      - users
 *      summary: 新增管理员信息
 *      consumes:
 *        - application/json
 *      parameters:
 *      - name: users
 *        in: body
 *        description: 新增管理员信息
 *        schema:
 *          type: object
 *          required:
 *            - id
 *            - account
 *            - token
 *          properties:
 *            obj:
 *              type: object
 *              required:
 *                - account
 *                - name
 *                - phone
 *                - roleId
 *                - state
 *              description: 新增数据对象
 *              properties:
 *                name:
 *                  type: string
 *                  description: 管理员姓名  
 *                account:
 *                  type: string
 *                  description: 管理员账号
 *                state:
 *                  type: integer
 *                  description: 账号状态    
 *                phone:
 *                  type: string
 *                  description: 管理员联系方式   
 *                roleId:
 *                  type: integer
 *                  description: 管理员角色编码      
 *            account:
 *              type: string
 *              description: 当前登录用户账号
 *            token:
 *              type: string
 *              description: 当前登录用户Token
 *      responses:
 *        200:
 *          description: successful operation
 * */
router.post('/add', userController.add)
router.post('/edit', userController.edit)

router.get('/del/:id', userController.del)

router.get('/findById/:id', userController.findById)


module.exports = router